﻿using System;
using System.Collections.Generic;
using System.Text;
using LibNoise;

namespace SampleImageGenerator.Modules.Primitives
{
	internal class Distance : IModule
	{
		public Double X { get; protected set; }
		public Double Y { get; protected set; }
		public Double Z { get; protected set; }

		public Distance()
		{
			X = 0;
			Y = 0;
			Z = 0;
		}

		public void SetOrigin(Double x, Double y, Double z)
		{
			X = x;
			Y = y;
			Z = z;
		}

		public double GetValue(double x, double y, double z)
		{
			Double dx = x - X;
			Double dy = y - Y;
			Double dz = z - Z;

			return System.Math.Sqrt(dx * dx + dy * dy + dz * dz); 
		}
	}
}
